<template>
  <fieldset>
    <legend>产品列表</legend>
    <ul>
      <li v-for="item in list" :key="item._id" @click="yang(item)">
        <!-- <router-link :to="{ path: `/detail/${item.productId}` }"> -->
        {{ item.productName }}
        <!-- </router-link> -->
      </li>
    </ul>
  </fieldset>
</template>

<script>
export default {
  data() {
    return {
      list: []
    }
  },
  methods: {
    yang(item) {
      this.$router.push(`/detail/${item.productId}`)
    }
  },
  mounted() {
    fetch("http://chst.vip:1234/api/getmoneyctrl")
      .then((body) => body.json())
      .then((res) => {
        console.log(res)
        this.list = res.result
      })
  }
}
</script>
